
from QMapMgr import QMapMgr

class QSingleMapMgr(QMapMgr):
    def __init__(self, mapHeaderKlass):
        QMapMgr.__init__(self)
        self.MapHeaderKlass = mapHeaderKlass
        self.LoadOnce = False

    def CmdSyncPeriodGet(self):
        if hasattr(self.MapHeaderKlass, "CmdSyncPeriod"):
            # get customize CmdSyncPeriod
            period = self.MapHeaderKlass.CmdSyncPeriod
        else:
            period = 0.1
        return period

    def NextMapHeaderLoad(self):
        if not self.LoadOnce:
            self.CurrentMapHeader = self.MapHeaderKlass()
            self.LoadOnce = True
            ret = True
        else:
            ret = False
        return ret

    def destroy(self):
        QMapMgr.destroy(self)